﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using AvatarHelper;
using Avatar.Model;

public partial class Admin_left : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            using (var _adc = DBHelper.GetDataContext())
            {
                Repeater2.DataSource = _adc.Management_Department.Where(d => d.Open == true).OrderBy(d => d.Order);
                Repeater2.DataBind();
            }
        }
    }
    protected void btn_Refresh_Click(object sender, EventArgs e)
    {
        Response.Redirect(Request.Url.ToString());
    }
    protected string getMenu(int _departmentID)
    {
        string _ok = string.Empty;
        using (var _adc=DBHelper.GetDataContext())
        {
            var _menus = _adc.Management_Category.Where(c => c.DepartmentID == _departmentID && c.Open == true).OrderBy(c => c.Order);
            foreach (var _menu in _menus)
            {
                _ok += "<div style='padding-left: 5px;'><a href='" + _menu.Url + "' target='MainFrame'>" + _menu.Name + "</a></div>";
            }
        }

        return _ok;
    }
}
